<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>使用Promise封装AJAX异步请求</title>
  </head>
  <body>
    <script src="js/ajax.js"></script>
  </body>
  <script>
    let url = `http://localhost:80/php`;
    ajax(`${url}/user.php?name=后盾人`)
      .then((user) => ajax(`${url}/houdunren.php?id=${user.id}`))
      .then(
        (lessons) => console.log(lessons),
        (reason) => console.log(reason)
      );
  </script>
</html>
